package org.wattdepot.cli.processor;

import java.util.List;
import org.wattdepot.cli.command.WattSummary;

/**
 * Parses the summary command.
 * 
 * @author Kendyll Doi
 * @author Kimberly Heu
 *
 */
public class SummaryCommand extends CommandLineInterface implements WattDepotCliCommand {
  
  /**
   * Parses the summary command.
   * 
   * @param args The user's inputed arguments.
   * @return The result of running the command.
   */
  public String doCommand (List<String> args) {
    StringBuffer buf = new StringBuffer(500); // Buffer to store the results
    String output = ""; // String with contents to return
    
    // Check that we have the appropriate number of commands for the method
    if (args.size() == 2) {
      // Continue if we have exactly two arguments
      buf.append(WattSummary.wattSummary(args.get(1), client));
    }
    else {
      // Give an error message
      buf.append("Incorrect number of arguments for summary command.");
    }
    
    // Convert buffer to string and return
    output = buf.toString();
    return output;
  }
}
